{include file="public/head"}
    <body>
    <div class="x-body">
      <div  class="lotus-nav" >
            <button class="layui-btn  layui-btn-sm"
            onclick="x_admin_show('添加工单','addPro.html',500,410)">
               <i class="layui-icon layui-icon-add-circle"></i>
            </button>

          <div class="layui-input-inline">
              <input value="{php}echo isset($_GET['telMan'])?$_GET['telMan']:'';{/php}"  name="telMan"   class="layui-input lotus-input"  placeholder="请输入值班人搜索">
          </div>

            <button class="layui-btn layui-btn-sm search-query"><i class="layui-icon layui-icon-search"></i></button>

            
            <span class="x-right">共有数据:<i class="i_count" style="color: red;font-size: 22px">{$count}</i>条 <button onclick="javascript:location.reload()" class="layui-btn layui-btn-xs"><i class="icon iconfont ">&#xe6aa;</i></button></span>

       </div>

    <table class="layui-table" lay-data="{id: 'test',limit:12}">
        <thead>
          <tr>
            <th lay-data="{field:'u_id',width:80}">值班人</th>
            <th lay-data="{field:'room'}">报修科室</th>
            <th lay-data="{field:'telMan',width:80}">报修人</th>
            <th lay-data="{field:'phone', width:120}">报修人电话</th>
            <th lay-data="{field:'place'}">位置</th>
            <th lay-data="{field:'desc'}">故障信息</th>
            <th lay-data="{field:'cate_id'}">故障类型</th>    <!--  关联分类表   -->
            <th lay-data="{field:'emer', width:90}">紧急程度</th>
            <th lay-data="{field:'status',width:90}">工单状态</th>    <!--  关联order表   -->
            <th lay-data="{field:'pubTime', sort:true}">填写时间</th>
            <th lay-data="{field:'Action', width:140}">操作</th>
        </thead>
        <tbody>

        {volist name="pros" id="vo"}
        	<tr>
              <td>{$vo.username}</td>
	            <td>{eq name='$vo["room"]' value="1"}
                <span>科室一</span>
                {/eq}
                {eq name='$vo["room"]' value="2"}
                <span>科室二</span>
                {/eq}
                {eq name='$vo["room"]' value="3"}
                <span>科室三</span>
                {/eq}
                {eq name='$vo["room"]' value="4"}
                <span>科室四</span>
                {/eq}
                {eq name='$vo["room"]' value="5"}
                <span>科室五</span>
                {/eq}
              </td>
              <td>{$vo.telMan}</td>
              <td>{$vo.phone}</td>
              <td>{$vo.place}</td>
              <td>{$vo.desc}</td>
              <td>{$vo.cName}</td>  <!--  关联分类表   -->
              <td>
                {eq name='$vo["emer"]' value="1"}
                <span>常规</span>
                {/eq}
                {eq name='$vo["emer"]' value="2"}
                <span style="color: #ff0000">紧急</span>
                {/eq}
              </td>
              <td>
                {eq name='$vo["status"]' value="1"}
                <span style="color: #FF5722">未处理</span>
                {/eq}
                {eq name='$vo["status"]' value="2"}
                <span style="color: #1E9FFF">处理中</span>
                {/eq}
                {eq name='$vo["status"]' value="3"}   
                <span style="color: #5FB878">已结束</span>
                {/eq}
              </td>  
              <td>{$vo.pubTime}</td>

	            <td style="padding: 5px 2px; width: 110px;">
                <button class="layui-btn layui-btn-xs layui-bg-green" onclick="x_admin_show('追踪工单','detail.html?pId={$vo.pId}',500,400)">追踪</button>

                {eq name='$vo["status"]' value="3"}
                {else /}
                <button class="layui-btn layui-btn-xs layui-bg-orange" onclick="x_admin_show('更改进度','change.html?id={$vo.id}&pId={$vo.pId}',500,400)" >更改</button>
                {/eq}
	              
	             	<button onclick="delPro(this,{$vo.pId})" class="layui-btn layui-btn-xs layui-btn-danger" style="float: right; margin-top: 3px">删除</button>

	           </td>
	        </tr>
        {/volist}
       
        </tbody>
      </table>
	      <div class="page">
	        <div>
	        	{$pros->render()}
	        </div>
	      </div>
    </div>
</body>
{include file="public/foot"}
    <script>
        var layer = layui.layer
            ,form = layui.form;


        $(".search-query").click(function () {
            var telMan = $("input[name=telMan]").val();
            window.location.href = 'prolist.html?telMan='+telMan;
        });

       /*用户-停用*/
      // function member_stop(obj,id){
      //     layer.confirm('确认要停用吗？',function(index){
      //         if($(obj).attr('title')=='启用'){
      //           //发异步把用户状态进行更改
      //           $(obj).attr('title','停用')
      //           $(obj).find('i').html('&#xe62f;');

      //           $(obj).parents("tr").find(".td-status").find('span').addClass('layui-btn-disabled').html('已停用');
      //           layer.msg('已停用!',{icon: 5,time:1000});

      //         }else{
      //           $(obj).attr('title','启用')
      //           $(obj).find('i').html('&#xe601;');

      //           $(obj).parents("tr").find(".td-status").find('span').removeClass('layui-btn-disabled').html('已启用');
      //           layer.msg('已启用!',{icon: 5,time:1000});
      //         }
              
      //     });
      // }


      function delAll (argument) {
        var data = tableCheck.getData();
        layer.confirm('确认要全部删除吗？',function(index){
            //捉到所有被选中的，发异步进行删除
            layer.msg('删除成功', {icon: 1});
            $(".layui-form-checked").not('.header').parents('tr').remove();
        });
      }

      function delPro(obj,id){
        var count = $(".i_count")[0].innerText;
        layer.confirm('确认要删除吗？',function(index){
            //捉到所有被选中的，发异步进行删除
            $.post("{:url('admin/proinfo/deletePro')}", {id: id}, function(data, textStatus, xhr) {
          /*optional stuff to do after success */
              console.log(data);
              if(data.code==1){
                  layer.msg(data.msg,{icon:1,time:1000},function(){
                    $(obj).parents('tr').remove();
                    $(".i_count").html(count-1);
                  });
              }else{
                  layer.msg(data.msg,{icon:2,time:1000});
              }
            
            });
        });
      }
    </script>
